keras中Flatten()函数的用法 |
您所在的位置:网站首页 › python flatten函数 › keras中Flatten()函数的用法 |
Flatten层的实现在Keras.layers.core.Flatten()类中。 作用: Flatten层用来将输入“压平”,即把多维的输入一维化,常用在从卷积层到全连接层的过渡。Flatten不影响batch的大小。 例子: from keras.models import Sequential from keras.layers.core import Flatten from keras.layers.convolutional import Convolution2D from keras.utils.vis_utils import plot_model model = Sequential() model.add(Convolution2D(64,3,3,border_mode="same",input_shape=(3,32,32))) # now:model.output_shape==(None,64,32,32) model.add(Flatten()) # now: model.output_shape==(None,65536) plot_model(model, to_file='Flatten.png', show_shapes=True) 为了更好的理解Flatten层作用,我把这个神经网络进行可视化如下图: |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |